// 引入封装好的axios函数
import request from "@/utils/request";
import type {
  GetCatListParams,
  GetSongListParams,
  SongListParams,
} from "./model/songList/songList";

// 枚举路径
enum Api {
  getPlayListUrl = "/top/playlist",
  getCatListUrl = "/playlist/catlist",
}

/**
 * 1:请求歌单列表数据
 * @param param0:limit是一页多少条数据,order是当前分类,offset是当前页码
 * @returns
 */
export const getPlayListApi = ({
  limit,
  cat,
  order,
  offset,
}: GetSongListParams) => {
  return request.get<unknown, SongListParams>(Api.getPlayListUrl, {
    params: {
      limit,
      cat,
      order,
      offset,
    },
  });
};

export const getCatListApi = () => {
  return request.get<unknown, GetCatListParams>(Api.getCatListUrl);
};
